home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mac-Source 1994 July
/
Mac-Source_July_1994.iso
/
Other Langs
/
Parallaxis_20
/
rot.p
< prev
next >
Wrap
Text File
|
1990-05-31
|
2KB
|
69 lines
SYSTEM image_rotation;
CONST m_size = 4;
CONFIGURATION Pic [m_size],[m_size];
CONNECTION right : Pic [i, j] -> Pic [i, j+1].left;
left : Pic [i, j] -> Pic [i, j-1].right;
up : Pic [i, j] -> Pic [i+1, j].down;
down : Pic [i, j] -> Pic [i-1, j].up;
SCALAR pic_size, size2: integer;
i,j : integer;
picture : ARRAY [1..m_size],[1..m_size] OF integer;
VECTOR color, buffer,b2: integer;
x,y : integer;
BEGIN
(* init *)
pic_size := m_size;
(* create test pattern *)
for i:=1 to m_size do
for j:=1 to m_size do
picture[i,j] := 0
end;
end;
for i:=1 to m_size do picture[i,i] := i
end;
load(color, picture);
WHILE pic_size > 1 DO
size2 := pic_size div 2;
PARALLEL
y := dim1 mod pic_size;
x := dim2 mod pic_size;
buffer := color;
IF x < size2 THEN propagate.up ^size2 (buffer);
IF y>=size2 THEN b2 := buffer END
ELSE propagate.down^size2 (buffer);
IF y< size2 THEN b2 := buffer END
END;
buffer := color;
IF y < size2 THEN propagate.left ^size2 (buffer);
IF x< size2 THEN b2 := buffer END
ELSE propagate.right^size2 (buffer);
IF x>=size2 THEN b2 := buffer END
END;
color := b2; (* copy new value *)
ENDPARALLEL;
pic_size := size2;
store(color, picture);
(* print image *)
writeln;
for i:=1 to m_size do
for j:=1 to m_size do
writeint(picture[i,j],2)
end;
writeln;
end
END; (* while *)
END image_rotation.